/**
 * @param {Egg.Application} app - egg application
 */

const API_VERSION = '/api/v1';
const apiPrefix = {
  login: `${API_VERSION}/login`
};

module.exports = app => {
  const { router, controller } = app;
  router.get('/', controller.home.index);

  router.post(
    `${API_VERSION}/login`,
    controller.account.accountLogin
  );

  router.get(`${API_VERSION}/history/list`, app.jwt, controller.callHistory.getHistoryList)
  router.post(`${API_VERSION}/history/add`, app.jwt, controller.callHistory.addHistory)
  router.post(`${API_VERSION}/history/update`, app.jwt, controller.callHistory.updateHistory)
  router.post(`${API_VERSION}/history/del`, app.jwt, controller.callHistory.delHistory)
  router.post(`${API_VERSION}/history/del_all`, app.jwt, controller.callHistory.delAllHistory)

  router.get(`${API_VERSION}/classes/list`, app.jwt, controller.classes.getClasses)
  router.post(`${API_VERSION}/classes/add`, app.jwt, controller.classes.addClasses)
  router.post(`${API_VERSION}/classes/update`, app.jwt, controller.classes.updateClasses)
  router.post(`${API_VERSION}/classes/delete`, app.jwt, controller.classes.delClasses)

  router.get(`${API_VERSION}/student/list`, app.jwt, controller.student.getStudentList)
  router.post(`${API_VERSION}/student/add`, app.jwt, controller.student.addStudent)
  router.post(`${API_VERSION}/student/update`, app.jwt, controller.student.updateStudent)
  router.post(`${API_VERSION}/student/delete`, app.jwt, controller.student.delStudent)
  router.post(`${API_VERSION}/student/batch_add`, app.jwt, controller.student.batchAddStudent)
  router.post(`${API_VERSION}/student/batch_excel_add`, app.jwt, controller.student.batchExcelStudent)
};
